package com.es.www.kyl.controller.web;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import com.es.www.kyl.bean.R;
import com.es.www.kyl.service.UploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author Estranger
 * @date 2025/8/1
 * description
 */
@Api(tags = "文件模块")
@RequiredArgsConstructor
@RestController
@RequestMapping("/web/file")
public class FileController {

	private final UploadService uploadService;

	@ApiOperation("文件上传")
	@RequestMapping("/upload")
	public R<String> upload(@RequestParam("file") MultipartFile file) throws IOException {
		return R.successResponse(uploadService.upload(file));
	}
}
